package com.zk.stock.config;

import com.zk.stock.pojo.vo.StockInfoConfig;
import com.zk.stock.utils.IdWorker;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;

/**
 * @author 曹自康的Laptop
 * @version 1.0
 * @Date 2024-06-2814:44
 * @Description 通用配置
 */
@Configuration
@EnableConfigurationProperties({StockInfoConfig.class})// 开启对象相关配置加载
public class commonConfig {
    /**
     * 密码加密器 匹配器
     * @return
     * **/
    @Bean
    public PasswordEncoder passwordEncoder(){
        return new BCryptPasswordEncoder();

    }

    @Bean
    public IdWorker idWorker(){
        // 机器id  机房Id     一般由运维人员进行人员规划
        return  new IdWorker(1L,2L);
    }
}
